void copydouble(double *x,int xstart,double *y,int n);
void scopydouble(double *x,int xstart,int xskip,double *y,int ystart,int yskip,int n);
DOUBLE min3(double *a,double *b,double *c,int *ta,int *tb,int *tc,int lim);
void Merge3(double *p1,double *p2,double *p3,double *x,int start,int length);
void TriMergeSort(double *x,int j,int J);
void fwtmed(double *x,int l,int d,double *wc,int n,int J);
DOUBLE q1(DOUBLE d);
DOUBLE q2(DOUBLE d);
DOUBLE q1left(DOUBLE d);
DOUBLE q2left(DOUBLE d);
DOUBLE q3left(DOUBLE d);
void QuadMedRefine(DOUBLE m1,DOUBLE m2,DOUBLE m3,DOUBLE *fine1,DOUBLE *fine2,DOUBLE *fine3);
void QuadMedRefineLeft(DOUBLE m1,DOUBLE m2,DOUBLE m3,DOUBLE *fine1,DOUBLE *fine2,DOUBLE *fine3);
void MedRefineSeq(DOUBLE *coarse,DOUBLE *interp,int n,int d);
void QuadAveRefine(DOUBLE m1,DOUBLE m2,DOUBLE m3,DOUBLE *fine1,DOUBLE *fine2,DOUBLE *fine3);
void QuadAveRefineLeft(DOUBLE m1,DOUBLE m2,DOUBLE m3,DOUBLE *fine1,DOUBLE *fine2,DOUBLE *fine3);
void AveRefineSeq(DOUBLE *coarse,DOUBLE *interp,int n,int d);
void iwtave(double *wc,int l,int d,double *x,int n,int J);
void fwtave(double *x,int l,int d,double *wc,int n,int J);
void QuadLMIRefine(DOUBLE m1,DOUBLE m2,DOUBLE m3,DOUBLE *fine1,DOUBLE *fine2,DOUBLE *fine3);
void QuadLMIRefineLeft(DOUBLE m1,DOUBLE m2,DOUBLE m3,DOUBLE *fine1,DOUBLE *fine2,DOUBLE *fine3);
